
Array.prototype.twist = function (curr) {
  const included = this.includes(curr);

  return included ? this.filter((item) => item !== curr) : this.concat(curr);
};

Array.prototype.remove = function (fn) {
  const i = this.findIndex(fn);
  i > -1 && this.splice(i, 1);
};

export function getValueFromEvent(event) {
  if (!event) {
    return event;
  }

  if (event.target) {
    return event.target.value;
  }

  return event;
}
